package com.poorstu.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import com.common.base.web.BaseAction;
import com.poorstu.manager.LeaseManager;

public class LeaseDeleteAction extends BaseAction {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		    try{
		    	DynaActionForm dyaction=(DynaActionForm)form;
		    int leaseid[]=(int[])dyaction.get("lease");
			//int a[]=new int[10];
			
//			for(int i=0;i<leaseid.length;i++){
//				a[i] = Integer.parseInt(leaseid[i]);
//			}
			LeaseManager leaseMag=(LeaseManager)getBean("leaseManager");
			int r = leaseMag.leaseDelete(leaseid);
			if(r==1){
				return mapping.findForward("succ");
			}
		    }catch(Exception e){
		    	e.printStackTrace();
		    	return mapping.findForward("failure");
		    }
			return mapping.findForward("failure");
		}
}
